const fs = require('fs');

let server = function (app, db) {
    //?Cookie查询
    const View_Cookie = function (request, calka) {
        db.query('select * from login where UserCookie=\'' + request.cookies.DOM_Cookie + '\'', function (err, data) {
            calka(err, data)
        })
    }

    //?js响应
    app.get('/js/:lei', function (request, response) {
        fs.readFile(`js/${request.params.lei}`, function (err, data) {
            response.header({"Content-Type":"text/javascript"})
            response.send(data)
        })
    })

    //?css响应
    app.get('/css/:lei', function (request, response) {
        fs.readFile(`css/${request.params.lei}`, function (err, data) {
            response.header({"Content-Type":"text/css"})
            response.send(data)
        })
    })

}
module.exports = server
